package com.example.cinema.bindingdata;

import android.view.View;
import android.widget.ImageView;

import androidx.databinding.BindingAdapter;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.example.cinema.R;

/**
 * 帖子图片展示
 */
public class ImagePageData {
    @BindingAdapter("imgpageurl")
    public static void setImage(View view,String url)
    {
        if(url!= null)
        {
            RequestOptions options = new RequestOptions()
                    .placeholder(R.mipmap.defaut_img)
                    .error(R.mipmap.defaut_img)
                    .fallback(R.mipmap.defaut_img);
            Glide.with(view).load(url)
                    .apply(options)
                    .into((ImageView) view);
        }
    }
    public String imgurl;//图片地址
}
